home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 26
/
Cream of the Crop 26.iso
/
doom
/
turric03.zip
/
TURRIC03.ZIP
/
PROGS
/
LAZSIGHT.QC
< prev
next >
Wrap
Text File
|
1997-01-07
|
3KB
|
132 lines
////////////////////////////////////////////
// laser targeter functions
// free player entity variable
// '.float speed' bit-flag defines:
float LASERTARG_LIT = 2;
float LASERTARG_ON = 1;
// targeter ent. think function
void() LaserTargeterTrack = {
local vector src;
if (self.owner.morphnum != 0)
{
remove(self);
return;
}
if (! (self.owner.speed & LASERTARG_ON))
{
if( (self.owner.speed & LASERTARG_LIT) )
{
self.owner.speed = self.owner.speed | LASERTARG_ON;
self.effects = self.effects | EF_DIMLIGHT;
}
else
{
remove( self );
return;
}
}
makevectors( self.owner.v_angle );
src = self.owner.origin + v_forward * 10;
src_z = self.owner.absmin_z + self.owner.size_z * 0.7;
traceline( src, src + v_forward * 2048, FALSE, self.owner);
//** PATCH_BEGIN - lazsight ****
// Added from Scott Ramsay's lazsight patch
if (trace_fraction == 1.0)
{
// move sight inside player if can't hit anything
setorigin(self, self.owner.origin );
return;
}
// check if target is damageable and set proper model
//** PATCH_BEGIN - lazsight - Turrican ****
// Using the laser sight model from Ultimate Quake.
if (trace_ent.takedamage)
{
self.skin = 1;
setmodel (self, "progs/lazsight.mdl");
if(time > self.wait)
{
sound (self.owner, CHAN_ITEM, "weapons/lazsight.wav", 0.1, ATTN_NORM);
self.wait = time + 0.5;
}
}
else
{
self.skin = 0;
setmodel (self, "progs/lazsight.mdl");
}
//** PATCH_END - lazsight - Turrican ******
// move sight at line of sight collision
self.angles = vectoangles(v_forward);
setorigin(self, trace_endpos );
// setorigin( self, (0.1 * src + 0.9 * trace_endpos) );
//** PATCH_END - lazsight ******
self.nextthink = time + 0.05;
};
void( entity targ_owner ) LaserTargeterToggle =
{
local entity e;
if( (targ_owner.speed & LASERTARG_ON) )
{
if( (targ_owner.speed & LASERTARG_LIT) )
{
targ_owner.speed = targ_owner.speed - LASERTARG_LIT;
sprint(targ_owner, "Laser sight off\n");
}
else
{
targ_owner.speed = targ_owner.speed | LASERTARG_LIT;
sprint(targ_owner, "Laser sight lit\n");
}
targ_owner.speed = targ_owner.speed - LASERTARG_ON;
}
else
{
targ_owner.speed = targ_owner.speed | LASERTARG_ON;
e = spawn();
e.owner = targ_owner;
e.movetype = MOVETYPE_NONE;
e.solid = SOLID_NOT;
//** PATCH_BEGIN - lazsight - Turrican ****
// Using the laser sight model from Ultimate Quake.
// setmodel( e, "progs/s_bubble.spr" );
// setmodel (self, "progs/lazsight.mdl");
//** PATCH_END - lazsight - Turrican ******
setsize( e, VEC_ORIGIN, VEC_ORIGIN );
setorigin( e, e.owner.origin );
if( (e.owner.speed & LASERTARG_LIT) )
e.effects = e.effects | EF_DIMLIGHT;
e.nextthink = time + 0.1;
e.think = LaserTargeterTrack;
sprint(targ_owner, "Laser sight on\n");
}
};
////////////////////////////////////////////